
(function($, win, doc){
	
	function getTransParams(){
		
		var ctrlDialog = win.parentDialogObj && win.parentDialogObj["ctrlDialog"];
		
		return ctrlDialog.getTransParams();
	}
	
	function getTableInfo(){
		
		return getTransParams().formBaseInfo.formBaseInfo.tableInfo;
	}
	
	function getConfig(){
		
		return getTransParams().params;
	}
	
	function getAllViewAuthList(){
		
		return top.document.getElementById('formdesign-frame').contentWindow.allViewAuthList;
	}
	
	function getFormCode(){
		
		var formCode = top.document.getElementById('formdesign-frame').contentWindow.$("#formCode").val();
		
		return formCode ? formCode.trim() : null;
	}
		
	var app = new Vue({
		el: '#app',
		data: {
			style:{

			},
			basic:{
				isUpdate: false
			},
			editAuthListSelect:{
				props: {}, 
				options: [
					{ id: '...', value: '...', label: '...' }
				]
			},
			formData:{
				operationAuthorization: null,
				rules: {
					operation: [
						{ required: true, message: '请选择', trigger: 'change' }
					]
				}
			}
		},
		methods:{
			init: function(){
				
				this.initFields();
			},
			initFields: function(){

				var _this = this;
				var viewAuthList = getAllViewAuthList();
				var editAuthList = viewAuthList.editAuthList;
				
				this.editAuthListSelect.options = [];
				
				for(var i=0,len=editAuthList.pcEditAuthList.length; i<len; i++){
					
					this.editAuthListSelect.options.push({ 
						id: editAuthList.pcEditAuthList[i].authId, 
						value: editAuthList.pcEditAuthList[i].authId, 
						label: editAuthList.pcEditAuthList[i].authName 
					});
				}
				
				var config = getConfig();
				
				this.formData.operationAuthorization = config.operationAuthorization;
				
				
			},
			onOperationAuthorizationChange: function(value){
				
			}
		},
		created: function(){
			this.init();
		}
	});
	

	/**
	 *	保存返回数据
	 */
	win['OK'] = function () {
		
		if(!app.formData.operationAuthorization){
			
			alert('请绑定操作！');
			
			return { valid : false };
		}
		
		return {
			valid: true,
			data: {
				operationAuthorization: app.formData.operationAuthorization
			}
		};
	};
	
})(Snail, window, document);